/*
 * =====================================================================================
 *
 *       Filename:  fork.c
 *
 *    Description:  fork()demo
 *
 *        Version:  1.0
 *        Created:  04/10/2012 01:47:54 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Zhiyi Wu (Z.W), zhiyiw@uoregon.edu
 *        Company:  University of Oregon
 *
 * =====================================================================================
 */

#include	"stdio.h"
#include <unistd.h>
#include <sys/types.h>
main(){
 int return_value;
 char *arg[]={"ls","l", NULL};
 char *env[] ={"/usr/", NULL};
 
 
	printf("Forking process\n");
	return_value=fork();
	printf("The process id is %d,and return value is %d\n",
			getpid(), return_value);
	execl("/bin/ls","ls","-l",NULL);
//	execl("/bin/ls","ls","-l",0);

printf("This line is not printed\n");
}

